package cn.wolfcode;

import cn.wolfcode.doamin.Employee;
import cn.wolfcode.mapper.DepartmentMapper;
import cn.wolfcode.mapper.EmployeeMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class employeeTest3 {
    @Autowired
    private DepartmentMapper departmentMapper;
    @Autowired
    private EmployeeMapper employeeMapper;
    @Test
public void test(){
        QueryWrapper<Employee> wrapper = new QueryWrapper<>();
        List<Employee> employees =
                employeeMapper.selectList(wrapper);
        for (Employee employee : employees) {
            employee.setDept(departmentMapper.selectById(employee.getDeptId()));
        }
    }

}
